<script setup lang="ts">
import {useRouter} from "vue-router";

let router = useRouter();
const toHome = () => {
  router.push("/problem")
}
</script>

<template>
  <div class="usage-container">
    <h1 class="usage-title">如何使用</h1>

    <div class="usage-steps">
      <div class="step-card">
        <div class="icon-wrapper">
          <i class="icon-edit"></i>
        </div>
        <h2>答题</h2>
        <p>在编辑器中回答问题</p>
      </div>

      <div class="arrow">→</div>

      <div class="step-card">
        <div class="icon-wrapper">
          <i class="icon-check"></i>
        </div>
        <h2>评分</h2>
        <p>提交获得评分和反馈</p>
      </div>
    </div>

    <p class="usage-hint">重复这个过程来持续练习，得到 8 分以上即可通过该题</p>

    <button class="start-button" @click="toHome">立即开始</button>
  </div>
</template>

<style scoped>
.usage-container {
  padding: 2rem;
  text-align: center;
  max-width: 1200px;
  margin: 0 auto;
}

.usage-title {
  font-size: 2rem;
  margin-bottom: 3rem;
}

.usage-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.step-card {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 200px;
  transition: box-shadow 0.3s ease;
}

.step-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.icon-wrapper {
  background: #f5f5f5;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.icon-edit::before {
  content: "✎";
  font-size: 1.5rem;
}

.icon-check::before {
  content: "✓";
  font-size: 1.5rem;
}

.arrow {
  font-size: 2rem;
  color: #666;
}

.usage-hint {
  color: #666;
  margin: 2rem 0;
}

.start-button {
  background: #14162c;
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 2rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.3s;
}

.start-button:hover {
  background: #2a2d4a;
}

@media screen and (max-width: 768px) {
  .usage-container {
    padding: 1rem;
  }

  .usage-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
  }

  .usage-steps {
    flex-direction: column;
    gap: 1rem;
  }

  .step-card {
    width: 100%;
    max-width: 300px;
    padding: 1.5rem;
  }

  .arrow {
    transform: rotate(90deg);
  }
}

@media screen and (max-width: 480px) {
  .usage-title {
    font-size: 1.25rem;
  }

  .step-card {
    padding: 1rem;
  }

  .icon-wrapper {
    width: 50px;
    height: 50px;
  }

  .icon-edit::before,
  .icon-check::before {
    font-size: 1.25rem;
  }

  .usage-hint {
    font-size: 0.9rem;
    margin: 1.5rem 0;
  }

  .start-button {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
  }
}
</style>
